import React from 'react';
import { connect } from 'dva';
import { List, WhiteSpace } from 'antd-mobile';
import { jump } from '../../utils';
import ChildWrap from '../../components/layout/childWrap';

const Item = List.Item;
/*
* function
* */
function Overview({ dispatch }) {
    const banner = require('../../assets/img/banner.png');
    const go = (args) => (e) => {
        e.preventDefault();
        jump(dispatch)(`home/${args}`);
    };
    return (
        <ChildWrap
            content="首页"
        >
            <img src={banner} style={{ width: '100%' }}/>
            <WhiteSpace size="lg"/>
            <List>
                <Item
                    thumb={require('../../assets/img/patients.png')}
                    arrow="horizontal"
                    onClick={go.bind(null, 'check')()}
                >
                    住院患者
                </Item>
            </List>
            <WhiteSpace size="lg"/>
            <List>
                <Item
                    thumb={require('../../assets/img/discuss.png')}
                    arrow="horizontal"
                    onClick={go.bind(null, 'discuss')()}
                >
                    病历讨论
                </Item>
            </List>
            <WhiteSpace size="lg"/>
            <List>
                <Item
                    thumb={require('../../assets/img/notify.png')}
                    arrow="horizontal"
                    onClick={go.bind(null, 'notification')()}
                >
                    手术通知
                </Item>
            </List>
        </ChildWrap>
    );
}
/*
 * 需要引用的model，解构传入mapStateToProps方法，并返回出来；
 * 组建的props中将会获取model数据
 * */
function mapStateToProps({ home }) {
    return { home };
}

export default connect(mapStateToProps)(Overview);
